import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Home from '@/views/Home'
import Element from '@/views/Element'
import CSS from '@/views/CSS'
import MyComment from '@/Views/MyComment'
import Grammar from '@/views/Grammar'
import NewPage from '@/views/NewPage'

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    },
    {
      path: '/element',
      name: 'Element',
      component: Element
    },
    {
      path: '/css',
      name: 'CSS',
      component: CSS
    },
    {
      path: '/mycomment',
      name: 'MyComment',
      component: MyComment
    } ,
    {
      path: '/grammar', 
      name: 'Grammar',
      component: Grammar
    },
    {
      path: '/newpage', 
      name: 'NewPage',
      component: NewPage
    }
  ]
})
